#ifndef _CARET_H_
#define _CARET_H_
#include <interfacelib/window/Box.h>

#include <windows.h>
#include <d3d9.h>

#define		CARET_BLINK_TIME					500
#define		ERROR_DRAWCARET_OVERSIDE_WINDOW		1

namespace interfacelib
{
	namespace Window
	{
		class Window;
		class EditBox;
		class Caret : public Box
		{
		public :
		enum
		{
			WINDOW_CARET_DISABLE,
			WINDOW_CARET_NORMAL,
			WINDOW_CARET_HALF,
			WINDOW_CARET_FULL
		};
		public:
			Caret();
			virtual ~Caret();

			virtual void initialize();

			virtual BYTE draw( RECT *rect );

			void setParent( Window *window ){  m_parentWindow = window; };

			void setInsertMode() { m_insertMode = !m_insertMode ; };
			bool isInsertMode(){ return ( m_insertMode );};

			void increaseStringPos( unsigned short int count = 1 ){ m_stringPos += count; };
			void decreaseStringPos( unsigned short int count = 1 ){ m_stringPos -= count; };

			unsigned short int getStringPos(){ return ( m_stringPos ); };
			void setStringPos( unsigned short int pos ) { m_stringPos = pos ;};

			void setCaretYPos( DWORD ypos ) { m_currentLineYPos = ypos ;};

		private:
			Window *m_parentWindow;

			unsigned short int m_stringPos;
			DWORD m_currentLineYPos;
			BYTE m_CaretType;
			bool m_visibleCaret;
			bool m_insertMode;

			friend interfacelib::Window::EditBox;
		};
	}
}

#endif